Hi all,

Having had a look at the COBs from Cyberlife's ObjectPack1 and Eggs update we have discovered a few extra goodies about the C2 COB format. BoBCoB has been modified to handle these changes.

First of all, it is possible to have multiple Agents per COB file (an Agent being an object that can be injected, eg. a piece of cheese).

Second, the graphic filename is actually part of a LIST of required files.

Third, author information can be put in the COB file as well.

Details:

The basic structure of the file is different to what we originally thought. The file consists of an identifying tag, "cob2", and then 1 or more blocks. Each block is identified by a 4 byte tag, Agent blocks - "agnt", Author information blocks - "auth", File blocks - "file". After the 4 byte tag, we have a double word (unsigned long), which is the length of the data for that block excluding the tag and this length value.

This implies that there could be other block types (other than agnt and auth) so any loading code that you write should take this into account.

So basically a COB file looks like this:

Length | Description
-------+------------
4      | "cob2"
varies | block 1
varies | block 2
...
varies | block n

The Agent block format is as follows:

Length | Description
-------+------------
4      | "agnt"
4      | length of data after this value (long)
2      | number of times agent can be injected (integer)
4      | last time agent was injected (possibly C time_t type)
4      | how many seconds before agent can be injected again (long)
16     | unknown - all zeros in COBs I've seen
varies | agent's name (zero-terminated string)
varies | agent's description (zero-terminated string)
varies | injection script, aka install script (zero-terminated string)
varies | remover script (zero-terminated string)
2      | number of object scripts, aka event scripts (integer)
... for each object script
varies | object script (zero-terminated string)
...
2      | number of files required by agent (sounds and sprites)
... for each required file
2      | type of file (0 = s16, 1 = wav)
varies | name of file eg. cmac.s16 (zero-terminated string)
...
2      | width (in pixels) of injector picture (integer)
2      | height (in pixels) of injector picture (integer)
varies | injector picture in 565 s16 format - just pixel data

The Author information block format is as follows:

Length | Description
-------+------------
4      | "auth"
4      | length of data after this value (long)
1      | day part of creation date (byte)
1      | month part of creation date (byte)
2      | year part of creation date (integer)
2      | unknown - possible time?
varies | author's name (zero-terminated string)
3      | unknown - all zeroes in COBs I've seen

The File block format is as follows:

Length | Description
-------+------------
4      | "file"
4      | length of block data (long)
2      | file type, 0 = s16, 1 wav (integer)
4      | unknown, always 0 so far
4      | length of file data (long)
varies | filename eg. "gat2.wav" (zero-terminated string)
varies | file data
